<?php
/**
 * @file
 * Download Monitor - Allows you to trace file downloads. Just place the direct link
 * to the file on the web, and specify the extensions of files you want to trace in the GUI.
 * It creates interactive chart and records downloads for today, yesterday, this week,
 * last week, this month, last month and total.
 * Requires writable .htaccess file of Apache Web server in Joomla root folder.
 * @package download-monitor
 * @version 1.0
 * @revision @REVISION@
 * @license http://www.gnu.org/licenses/gpl-3.0.txt     GNU General Public License v3
 * @copyright (C) 2012 by CodeGravity.com - All rights reserved!
 * @website http://www.codegravity.com
 */

if($task=='edit_file')
{
	$filepathquery_edit = sprintf("SELECT * FROM #__download_monitor_paths where did='%d'", (int)$did);
	$db->setQuery($filepathquery_edit);
	$filepathar_edit = $db->loadRow();
	$editfilepathname = $filepathar_edit[1];
	
	if (isset($_POST['Submit']) && $_POST['Submit']=="Update") 
	{
		$filepathname = trim(mysql_escape_string($_POST['filepathname']));
		
		$filepathquery = sprintf("update #__download_monitor_paths set dname='%s' where did='%d'", mysql_escape_string($filepathname), (int) $did);
		$db->setQuery($filepathquery);
		$db->query();
		header("location: index.php?option=com_download-monitor");
	}
?>
            <form action="" method="post" name="editfilepathform" onsubmit="return check_edit_filepath();">
              <table width="83%" border="0" cellpadding="3" cellspacing="0" class="table">
                <tr> 
                  <td colspan="2" class="Subtitle">Edit File/Path </td>
                </tr>
                <tr> 
                  <td width="31%"> 
                    <div align="right">File/Path Name<font color="#FF0000"> *</font>                    </div>                  </td>
                  <td width="69%" align="left"> 
                    <input name="filepathname" type="text" size="50" value="<?php echo $editfilepathname?>">                  </td>
                </tr>
                <tr class="title"> 
                  <td height="20" colspan="2"> 
                    <div align="center"> 
                      <input name="Submit" type="submit" class="button" value="Update">
					  <input name="Submit" type="button" class="button" value="Back" onclick="window.location.href='index.php?option=com_download-monitor'">
                    </div>                  </td>
                </tr>
              </table>
              <br>
            </form>
<?php
}
?>